using System;

class Bit3OfIntegerIs1or0
{
	static void Main()
	{
		//Write a boolean expression for finding if the bit 3 (counting from 0) of a given integer is 1 or 0.

		//How to get the bit at position p in a number n?
		//int p = 5;
		//int n = 35; // 00000000 00100011
		//int mask = 1 << p; // 00000000 00100000
		//int nAndMask = n & mask; // 00000000 00100000
		//int bit = nAndMask >> p; // 00000000 00000001
		//Console.WriteLine(bit); // 1
		int position = 2;
		Console.WriteLine("Input number:");
		int number = Int32.Parse(Console.ReadLine());
		int mask = 1 << position;
		int numberAndMask = number & mask;
		int bit = numberAndMask >> position;
		object numberiNBinary = Convert.ToString(number,2);
		Console.WriteLine("Integer number: {1} = {2} in binary has bit : {3} at position {0}", (position+1) , number, numberiNBinary, bit);

	}
}